{% extends 'base.html' %}
{% block content %}
<div class="container mt-3">
  <h3>软件列表</h3>
  <form method="get" class="mb-3 d-flex" role="search">
    <input class="form-control me-2" type="search" placeholder="搜索名称/厂商/类别" name="q" value="{{ query|default:'' }}">
    <button class="btn btn-primary" type="submit">搜索</button>
    <a class="btn btn-success ms-2" href="{% url 'assets:software_create' %}">新增软件</a>
  </form>
  <table class="table table-striped">
    <thead>
      <tr>
        <th>名称</th>
        <th>厂商</th>
        <th>类别</th>
        <th>更新时间</th>
      </tr>
    </thead>
    <tbody>
      {% for s in page_obj %}
      <tr>
        <td><a href="{% url 'assets:software_detail' s.id %}">{{ s.name }}</a></td>
        <td>{{ s.vendor }}</td>
        <td>{{ s.category }}</td>
        <td>{{ s.updated_at }}</td>
      </tr>
      {% empty %}
      <tr><td colspan="4" class="text-center">无数据</td></tr>
      {% endfor %}
    </tbody>
  </table>
  {% include 'assets/_pagination.html' with page_obj=page_obj %}
</div>
{% endblock %}
